<?php
// $userName=$_COOKIE["userName"]; 接受cookie储存的值
// $password=$_POST["password"]; 接受post方式传来的参数
// $phone=$_Get["phone"]; 接受get方式传来的参数
@header("Content-Type:text/html;charset=utf-8");

//$sqlStr="xxx"; 定义sql语句后调用一下封装的函数

//查询
function query($sqlStr){
    $conn = mysqli_connect("b-vilvzicbildruf.bch.rds.gz.baidubce.com","b_vilvzicbildruf","sjh17683816318","b_vilvzicbildruf");
    mysqli_query($conn,"set names utf8");
    mysqli_query($conn,"set character set utf-8");
    $result=mysqli_query($conn,$sqlStr);
    $arr=array();
    while($item = mysqli_fetch_assoc($result)){
        array_push($arr,$item);
    }
    return $arr;
   
}

//增删改
function change($sqlStr){
    $conn = mysqli_connect("b-vilvzicbildruf.bch.rds.gz.baidubce.com","b_vilvzicbildruf","sjh17683816318","b_vilvzicbildruf");
    mysqli_query($conn,"set names utf8");
    mysqli_query($conn,"set character set utf-8");
    mysqli_query($conn,$sqlStr);
    $affectedRows=mysqli_affected_rows($conn);
    $result=array();
    if($affectedRows>0){
        $result["status"]=true;
    }else{
        $result["status"]=false;
    }
    return $result;
}
?>